import http from '@/api';
import { ADMIN_MODULE } from '@/api/helper/prefix';
import type { IPage } from '@/api/types';
import type { SysUserEmployeeQuery, SysUserEmployeeRow, SysUserEmployeeForm } from '@/api/types/sysuseremployee/sysUserEmployee';
import type { UploadRawFile } from 'element-plus/es/components/upload/src/upload';
import type { AxiosRequestConfig } from 'axios';

/**
 * 查询列表
 * @param params
 * @returns {*}
 */
export const getSysUserEmployeeListApi = (params: SysUserEmployeeQuery) => {
  return http.get<IPage<SysUserEmployeeRow>>(ADMIN_MODULE + `/sys-user-employee`, params);
};

/**
 * 添加
 * @param params
 * @returns {*}
 */
export const createSysUserEmployeeApi = (params: SysUserEmployeeForm) => {
  return http.post(ADMIN_MODULE + `/sys-user-employee`, params);
};

/**
 * 修改
 * @param params
 * @returns {*}
 */
export const updateSysUserEmployeeApi = (params: SysUserEmployeeForm) => {
  return http.put(ADMIN_MODULE + `/sys-user-employee`, params);
};

/**
 * 删除
 * @param params
 * @returns {*}
 */
export const removeSysUserEmployeeApi = (params: { ids: (string | number)[] }) => {
  return http.delete(ADMIN_MODULE + `/sys-user-employee`, params);
};

/**
 * 获取详情
 * @param params
 * @returns {*}
 */
export const getSysUserEmployeeDetailApi = (params: { id: number }) => {
  const { id } = params;
  return http.get<SysUserEmployeeRow>(ADMIN_MODULE + `/sys-user-employee/${id}`);
};

/**
 * 导入excel
 * @param params
 */
export const importSysUserEmployeeExcelApi = (params: UploadRawFile, config?: AxiosRequestConfig<any> | undefined) => {
  return http.upload(ADMIN_MODULE + `/sys-user-employee/import`, params, config);
};

/**
 * 导出excel
 * @param params
 * @returns {*}
 */
export const exportSysUserEmployeeExcelApi = (params: SysUserEmployeeQuery) => {
  return http.download(ADMIN_MODULE + `/sys-user-employee/export`, params);
};
